#ifndef CGRIDMAP_H
#define CGRIDMAP_H

#include <QObject>
#include <QVector>
#include <QThread>
#include <QMutex>

#include <QPoint>

class CGridMap : public QObject
{
    Q_OBJECT
public:
    CGridMap();

    CGridMap(quint16 size_x, quint16 size_y);

    ~CGridMap();

    void initGridMap(quint16 height, quint16 width);

    void resetMap();

    void updateGridMapData(QVector<QPoint>);
    const QVector<quint8> &getMapData() const {     return m_data;  }

    inline const quint16 &getMapSizeX()  const  {   return m_size_x;    }
    inline const quint16 &getMapSizeY()  const  {   return m_size_y;    }

    inline quint8 operator[](const quint32 idx) const
    {
        return m_data.at(idx);
    }

private:

    template<class T>
    void clearVector(QVector<T> &t)
    {
        QVector<T> tmp;
        tmp.swap(t);
    }

public slots:

private:

    QVector<quint8> m_data;

    quint16 m_size_x;
    quint16 m_size_y;

    QMutex mutex;
};


#endif // CGRIDMAP_H
